<template>
  <div class="container">
    <el-form :model="form" :inline="true" :rules="rules">
      <el-form-item label="学科名称" label-width="100px" prop="newSubjectName">
        <el-input v-model="form.newSubjectName" autocomplete="off" size="small" placeholder="请输入学科名称"></el-input>
      </el-form-item>
      <el-form-item label="是否显示" label-width="100px">
        <el-switch v-model="form.value" active-color="#13ce66" inactive-color="#ff4949"> </el-switch>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="$emit('close')">取 消</el-button>
      <el-button type="primary" @click="addFn(form)">确 定</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'addSubject',
  data () {
    return {
      form: {
        newSubjectName: '',
        value: 0
      },
      rules: {
        newSubjectName: [{ required: true, message: '请输入学科名称', trigger: 'blur' }]
      }
    }
  },
  methods: {
    addFn (value) {
      this.$emit('addSubject', value)
      this.form.newSubjectName = ''
    }
  }
}
</script>

<<<<<<< HEAD
<style scoped lang="scss">
::v-deep .dialog-footer {
  display: flex;
  justify-content: end;
}
</style>
=======
<style scoped lang='scss'></style>
>>>>>>> 215e2860be06d72afccb886a22f21f14ff59f66c
